type NameList = {
  name: string;
};

export const axios = (url: string): Promise<NameList[]> => {
  return new Promise((resolve, reject) => {
    let xhr: XMLHttpRequest = new XMLHttpRequest();

    xhr.open("GET", url);

    xhr.send(null);

    xhr.onreadystatechange = () => {
      if (xhr.readyState === 4 && xhr.status === 200) {
        var timer = setTimeout(() => {
          resolve(JSON.parse(xhr.responseText));
        }, 3000);
      }
    };
  });
};
